<?php

namespace App\Models\Permission;

use Illuminate\Database\Eloquent\Relations\Pivot;

class RolePermission extends Pivot {

    protected $table = 'role_permission';

    protected $fillable = [
        'role_id',
        'permission_id',
    ];

    public function roles() {
        return $this->belongsToMany(Role::class)->withPivot('id')->withTimestamps();
    }

    public function permissions() {
        return $this->belongsToMany(Permission::class)->withPivot('id')->withTimestamps();
    }
}
